package com.work03.service;

import com.work03.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author 绛河
 * @date 2023/5/11
 * @apiNote
 */
@Service
public class UserService {
    @Autowired
    private RedisTemplate redisTemplate;

    public void saveUser(User user) {
        redisTemplate.opsForValue().set("user", user);
    }

    public User getUser() {
        return (User) redisTemplate.opsForValue().get("user");
    }
}
